#ifndef PARSE_H_
#define PARSE_H_

#include "vertify.h"

int getReal(String inputString, char real[NUM_COMMAND_COMS]){
  int length = NUM_COMMAND_COMS;
  int rawLength = (2 * NUM_COMMAND_COMS) + 1;
  
  if(inputString.length() !=  rawLength){
    Serial.println(inputString.length());
    Serial.println(rawLength);
    Serial.println("Error:: In getReal, incorrect input string length.");
    return -1;
  }

  char stringRaw[rawLength + 1];

  inputString.toCharArray(stringRaw, rawLength + 1);
  //  Serial.println(stringRaw);
  
  if(checkDelinate(stringRaw, rawLength) < 0){
    Serial.println("Error:: In getReal, got incorret Delination.");
    return -1;
  }

  
  // Zero
  for(int i = 0; i < length; ++i){
    real[i] = 0;
  }

  int index = 0;
  for(int i = 1; i < rawLength - 1; i += 2, index++){
    int intForm = (int)stringRaw[i];
    real[index] = (unsigned char)intForm;
  }

  return 0;
}

int getValue(char* comps, int index){
  int length = NUM_COMMAND_COMS;
  
  if(index < 0 || index >= length){
    Serial.println("Error:: in getValue, got a bad index");
    return -1;
  }
  
  unsigned char un_sig = comps[index];
  return (int)un_sig;
}


#endif
